﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucForumThreadPosts.ascx.cs" Inherits="WCrawler.Controls.ucForumThreadPosts" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

<asp:UpdatePanel ID="PostForumUpdatePanel" runat="server">
        <ContentTemplate>
            <ajaxToolkit:TabContainer ID="TabContainerPost" runat="server" ActiveTabIndex="0"
                Width="100%">
                <ajaxToolkit:TabPanel ID="TabPanelForumTopic" runat="server" HeaderText="Forum Thread Posts">
                    <ContentTemplate>
                        <div>
                            <asp:Button ID="btnUpdatePostNum" runat="server" OnClick="btnUpdatePostNum_Click"
                                Text="Update Thread Post Num" Width="161px" />
                            <asp:Button ID="btnDeleteThreads" runat="server" OnClick="btnDeleteThreads_Click"
                                Text="Delete Threads" />
                        </div>
                        <div>
                            <asp:GridView ID="gridViewThreadPosts" runat="server" AllowSorting="True"
                                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ForumThreadId,PostDetailsId"
                                DataSourceID="ThreadPostLinqDataSource" ForeColor="#333333" Width="100%" 
                                OnRowDataBound="gridViewThreadPosts_RowDataBound">
                                <EmptyDataTemplate>
                                    <asp:Label ID="lblEmptySearch0" runat="server" Font-Bold="True" ForeColor="#0033CC">No Results Found....  
                                    </asp:Label>
                                </EmptyDataTemplate>
                                <AlternatingRowStyle BackColor="White" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Select">
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkHead" runat="server" onclick="changeCheckStateItem('chkItemThreadPost');" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkItemThreadPost" runat="server" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="#">
                                        <ItemTemplate>
                                            <asp:Label ID="lblNum" runat="server" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Thread Num" SortExpression="ThreadNum">
                                        <ItemTemplate>
                                            <asp:Label ID="lblThreadNum" runat="server" Text='<%#Bind("ForumThread.ThreadNum") %>'></asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="txtThreadNum" runat="server" Text='<%#Bind("ForumThread.ThreadNum") %>'></asp:TextBox>
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="PostNum" HeaderText="PostNum" SortExpression="PostNum" />
                                    <asp:TemplateField HeaderText="Thread" SortExpression="Topic">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="hyperLinkThread" runat="server" NavigateUrl='<%#Eval("ForumThread.Forum.ForumUrl") + "/" + Eval("ForumThread.ThreadUrl") %>'
                                                Text='<%#Eval("ForumThread.ThreadTitle") %>'> </asp:HyperLink>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Replies" SortExpression="Replies">
                                        <ItemTemplate>
                                            <asp:Label ID="lblReplies" runat="server" Text='<%#Bind("ForumThread.Replies") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Views" SortExpression="Views">
                                        <ItemTemplate>
                                            <asp:Label ID="lblViews" runat="server" Text='<%#Bind("ForumThread.Views") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="CreateOn" SortExpression="CreateOn">
                                        <ItemTemplate>
                                            <asp:Label ID="lblCreateOn" runat="server" Text='<%#Bind("ForumThread.CreateOn") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="UpdateOn" SortExpression="UpdateOn">
                                        <ItemTemplate>
                                            <asp:Label ID="lblUpdateOn" runat="server" Text='<%#Bind("ForumThread.UpdateOn") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                <PagerSettings Mode="NumericFirstLast" />
                                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                                <SortedAscendingCellStyle BackColor="#FDF5AC" />
                                <SortedAscendingHeaderStyle BackColor="#4D0000" />
                                <SortedDescendingCellStyle BackColor="#FCF6C0" />
                                <SortedDescendingHeaderStyle BackColor="#820000" />
                            </asp:GridView>
                        </div>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
                <ajaxToolkit:TabPanel ID="TabPanelSearchTopic" runat="server" HeaderText="Search Posts">
                    <ContentTemplate>
                        <div>
                            <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" 
                                Text="Search Threads" Width="140px" />
                            <asp:Button ID="btnSearchLatestThread" runat="server" OnClick="btnSearchLatestThread_Click"
                                Text="Search Latest Thread" Width="140px" />
                            <asp:Button ID="btnAddThreads" runat="server" Text="Add Selected Threads" 
                                OnClick="btnAddThreads_Click" Width="140px" />
                            <br />
                            </div>
                            <asp:GridView ID="gridViewSeachForumThread" runat="server" DataKeyNames="ThreadNum"
                                AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
                                Width="100%" OnRowDataBound="gridViewSeachForumThread_RowDataBound">
                                <AlternatingRowStyle BackColor="White" />
                                <EmptyDataTemplate>
                                    <asp:Label ID="lblEmptySearch" runat="server" Font-Bold="True" ForeColor="#0033CC">No Results Found....  
                                    </asp:Label>
                                </EmptyDataTemplate>
                                <Columns>
                                    <asp:TemplateField HeaderText="Select">
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkHead" runat="server" onclick="changeCheckStateItem('chkItemSearchForumThread');" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkItemSearchForumThread" runat="server" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="ThreadNum" SortExpression="ThreadNum">
                                        <ItemTemplate>
                                            <asp:Label ID="lblThreadNum" runat="server" Text='<%#Eval("ThreadNum") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="PostNum" SortExpression="PostNum">
                                        <ItemTemplate>
                                            <asp:Label ID="lblPostNum" runat="server" Text='<%#Eval("PostNum") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Thread">
                                        <ItemTemplate>
                                            <%--<%#Eval("Topic") %>--%>
                                            <asp:HyperLink ID="hyperLinkThread" runat="server" NavigateUrl='<%#Bind("Url") %>'
                                                Text='<%#Bind("Title") %>'> </asp:HyperLink>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Replies" SortExpression="Replies">
                                        <ItemTemplate>
                                            <asp:Label ID="lblReplies" runat="server" Text='<%#Eval("Replies") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Views" SortExpression="Views">
                                        <ItemTemplate>
                                            <asp:Label ID="lblViews" runat="server" Text='<%#Eval("Views") %>'> </asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Forum">
                                        <ItemTemplate>
                                            <%#Eval("Forum") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Post" SortExpression="Post">
                                        <ItemTemplate>
                                            <asp:DropDownList ID="PostDropDownList" runat="server" Width="100%" DataSourceID="PostLinqDataSource"
                                                DataTextField="PostTitle" DataValueField="PostId" SelectedValue='<%#Bind("PostId") %>'>
                                            </asp:DropDownList>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <EditRowStyle BackColor="#7C6F57" />
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#E3EAEB" />
                                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                                <SortedAscendingCellStyle BackColor="#F8FAFA" />
                                <SortedAscendingHeaderStyle BackColor="#246B61" />
                                <SortedDescendingCellStyle BackColor="#D4DFE1" />
                                <SortedDescendingHeaderStyle BackColor="#15524A" />
                            </asp:GridView>
                    </ContentTemplate>
                </ajaxToolkit:TabPanel>
            </ajaxToolkit:TabContainer>
</ContentTemplate>
    </asp:UpdatePanel>
    
<div>
    <asp:LinqDataSource ID="ForumThreadsLinqDataSource" runat="server" 
        ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
        onselecting="ForumThreadsLinqDataSource_Selecting" 
        TableName="ForumThreads" EnableDelete="True" EnableUpdate="True">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="ThreadPostLinqDataSource" runat="server" 
        ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
        TableName="ThreadPosts" onselecting="ThreadPostLinqDataSource_Selecting" 
        EnableDelete="True" EnableUpdate="True">
    </asp:LinqDataSource>
</div>
<asp:LinqDataSource ID="PostLinqDataSource" runat="server" 
    ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
    TableName="Posts">
</asp:LinqDataSource>

